package assdraw2.canvas.abstraction;

import java.awt.Color;
import java.awt.Rectangle;
import java.awt.geom.Ellipse2D;

import assdraw2.canvas.presentation.Visitor;



public class Circle extends Shape{

	private double radius;
	
	public Circle(double x, double y, double radius, Color c){
		super(x,y,c);
		this.radius = radius;
	}
	
	public Circle(double x, double y, Color c){
		super(x,y,c);
		this.radius = 30;
	}

	@Override
	public void scale(double fx, double fy) {
		radius = radius*fx;
	}

	public void setRadius(double radius) {
		this.radius = radius;
	}


	public double getRadius() {
		return radius;
	}

	@Override
	public boolean contains(double x2, double y2) {
		Ellipse2D.Double e = new Ellipse2D.Double(getX(), getY(), 2*radius, 2*radius);
		return e.contains(x2, y2);
	}

	@Override
	public void accept(Visitor v) {
		v.visit(this);
	}

	@Override
	public Rectangle getBoundary() {
		return new Rectangle((int)getX(), (int)getY(), (int)(2*radius), (int)(2*radius));
	}

	
}
